package com.trkj.controller.wdm;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONArray;
import com.trkj.service.ServiceException;
import com.trkj.service.wdm.HireStaffService;
import com.trkj.vo.Result2;

@Controller
public class StaffEmployedController {
	//调薪单
			@GetMapping("to_Increase")
			public	String to_Increase(){
				return "increase_yj";
			}
			@GetMapping("to_Increase_insert")
			public	String to_Increaseinsert(){
				return "increase_insert_yj";
			}
			
			
			
			
			@Autowired
			private HireStaffService hire;
			//员工录用
			@GetMapping("to_staffemployed")
			public String to_staffEmployed(){
				return "staffemployed_yj";
			}
			//员工录用查询所有
			@RequestMapping("to-findall-hirestaff")
			@ResponseBody
			public JSONArray to_staffFire(){
				return hire.findAll();
			}
			/**
			 * 员工录用新增
			 * @param s
			 * @return
			 * @throws ServiceException
			 */
			@RequestMapping("to_staffemployedinsert")
			@ResponseBody
			public Result2 addStaff(Long id,Long id2,String name) throws ServiceException{
				try {
					hire.addStaff(id,id2,name);
					return Result2.SUCCESS;
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
					return Result2.failure(e.getMessage());
				}
				
			}
			
			
			
			
			//员工录用修改
			@GetMapping("to_staffemployedupdate")
			public String to_staffEmployedupdate(){
				return "staffemployed_update_yj";
			}
}
